/*
 * Copyright 2016-2016 the original author or authors.
 * Created on 2016/12/26 下午8:48
 */
package cn.com.geasy.dao.system;

import cn.com.geasy.entity.system.SysAccount;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * 该类仅用于实现 {@link AccountRepositoryCustom} 接口。
 *
 * @author Mechanic
 * @version 1.0
 */
public class AccountRepositoryImpl implements AccountRepositoryCustom  {

    @PersistenceContext
    private EntityManager em;
    @Override
    public int deleteByUsername(String username){

        String strSQL = "DELETE FROM sys_account WHERE username =?";
        //this.em.createNativeQuery(strSQL).setParameter(0,id);
        //Query query = em.createNativeQuery(strSQL);
        //query.setParameter(1,id);

        return this.em.createNativeQuery(strSQL, SysAccount.class)
                      .setParameter(1, username)
                      .executeUpdate();
    }
}
